package com.itheima;

import com.itheima.pojo.User;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

public class Test01 {

    public static void main(String[] args) {

        List<User> list = new ArrayList<>();
        User user = new User();
        user.setName("zs");
        list.add(user);
        user =new User();
        user.setName("lisi");
        list.add(user);
        Map<String, User> collect =
                list.stream().collect(
                        Collectors.toMap(User::getName, idx -> idx, (o1, o2) -> o1));
        System.out.println(collect);
    }
}
